package com.boilermaker.springaoplearning.handler;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class UserInvocationHandler implements InvocationHandler {
    private Object target;

    public UserInvocationHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        System.out.println("前置通知: ...");

        Object ret = method.invoke(target, args);

        System.out.println("后置通知: ...");

        return ret;
    }
}
